<template>
	<view>
		<view class="header-back">
			<view class="flex-sb" :style="{'padding-top': navBarHeght + 'px'}">
				<view class="flex-center">
					<image class="avatar-image" src="../../static/zhanweitu.png"></image>
					<view class="user-back">
						<view class="nickname">用户昵称</view>
						<view class="user-id">用户ID：0001</view>
					</view>
				</view>
				<image class="set-image" src="../../static/setting.png"></image>
			</view>
			<view class="balance-back">
				<view class="balance-item">
					<view class="balance-text">0.00</view>
					<view class="name-text">账户余额</view>
				</view>
				<view class="balance-item">
					<view class="balance-text">0</view>
					<view class="name-text">优惠券</view>
				</view>
				<view class="balance-item">
					<view class="balance-text">0</view>
					<view class="name-text">我的收藏</view>
				</view>
				<view class="balance-item">
					<view class="balance-text">0</view>
					<view class="name-text">浏览记录</view>
				</view>
			</view>
		</view>
		<view class="main">
			<view class="item-back">
				<view class="flex-center-sb item-title">
					<view>我的订单</view>
					<view class="more-text" @click="menuAction(0)">查看全部订单 ></view>
				</view>
				<view class="menu-back">
					<view class="menu-item" v-for="(item,index) in orderMenu" @click="menuAction(index+1)">
						<image :src="item.image"></image>
						<view>{{item.name}}</view>
						<view class="badge-num" v-if="item.badge>0">{{item.badge}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "wts-personal",
		props: {
			orderMenu: [],
			navBarHeght: 0
		},
		data() {
			return {

			}
		},

		watch: {

		},
		methods: {
			menuAction(index) {
				this.$emit('menuAction', index)
			}
		}
	}
</script>

<style lang="scss">
	.flex {
		display: flex;
	}

	.flex-center {
		display: flex;
		align-items: center;
	}

	.flex-center-sb {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.flex-sb {
		display: flex;
		justify-content: space-between;
	}

	.header-back {
		background-image: linear-gradient(to bottom, #ff5400, #fff);
		background-size: 100% 90%;
		background-repeat: no-repeat;
		padding: 30rpx 30rpx 0 30rpx;

		.avatar-image {
			width: 140rpx;
			height: 140rpx;
			border-radius: 50%;
			border: #fff 6rpx solid;
		}

		.user-back {
			margin-left: 15rpx;
			color: #fff;

			.nickname {
				font-size: 36rpx;
				font-weight: bold;
			}

			.user-id {
				font-size: 28rpx;
				margin-top: 10rpx;
			}
		}

		.set-image {
			width: 45rpx;
			height: 45rpx;
		}

		.balance-back {
			padding: 30rpx;
			border-radius: 14rpx;
			background-color: #fff;
			margin-top: 50rpx;
			display: flex;
			align-items: center;

			.balance-item {
				width: 25%;
				text-align: center;

				.balance-text {
					font-size: 40rpx;
					font-weight: bold;
				}

				.name-text {
					font-size: 26rpx;
					margin-top: 10rpx;
					color: #666;
				}
			}
		}
	}

	.main {
		padding: 0 30rpx;

		.item-back {
			background-color: #fff;
			border-radius: 14rpx;
			margin-top: 30rpx;

			.item-title {
				// width: 100%;
				padding: 30rpx;
				border-bottom: #eee 2rpx solid;
				font-size: 32rpx;
				font-weight: bold;

				.more-text {
					color: #999;
					font-size: 26rpx;
				}
			}

			.menu-back {
				display: flex;
				align-items: center;
				justify-content: flex-start;
				flex-wrap: wrap;
				padding-bottom: 30rpx;

				.menu-item {
					width: 20%;
					display: flex;
					flex-direction: column;
					align-items: center;
					padding-top: 20rpx;
					position: relative;

					image {
						width: 60rpx;
						height: 60rpx;
					}

					view {
						font-size: 26rpx;
						margin-top: 10rpx;
					}

					.badge-num {
						position: absolute;
						right: 25rpx;
						top: 0;
						width: 30rpx;
						height: 30rpx;
						border-radius: 50%;
						background-color: red;
						color: #fff;
						font-size: 24rpx;
						line-height: 30rpx;
						text-align: center;
					}
				}
			}
		}
	}
</style>